Source: fivethirtyeight
AKA “Please just don’t make me point-and-click 100 charts”
Source: Hadley Wickham
Source: ggplot2
In the first edition of @FT's World Cup Extra series of stats-y briefings, @muradahmed and I ask: as curtain-raisers go, just how underwhelming is Russia vs Saudi Arabia?https://t.co/0aQXcaD9YV pic.twitter.com/GOXVyVlRW7
— John Burn-Murdoch (@jburnmurdoch) June 13, 2018
Source: Hadley Wickham
| name | year | category | lat | long | wind | pressure |
|---|---|---|---|---|---|---|
| Caroline | 1975 | -1 | 21.1 | -85.1 | 25 | 1014 |
| AL142003 | 2003 | -1 | 11.4 | -22.2 | 25 | 1009 |
| Gabrielle | 2001 | 0 | 27.1 | -82.6 | 60 | 983 |
| Andrew | 1992 | 4 | 25.4 | -77.5 | 125 | 930 |
| Iris | 1995 | 1 | 15.2 | -53.8 | 70 | 992 |
| Allison | 2001 | -1 | 31.5 | -95.0 | 20 | 1005 |
| Gilbert | 1988 | 4 | 23.9 | -97.0 | 115 | 950 |
| Ike | 2008 | 1 | 22.6 | -82.9 | 70 | 965 |
| Ida | 2015 | -1 | 19.7 | -45.7 | 30 | 1005 |
| Opal | 1995 | 0 | 20.8 | -91.6 | 50 | 985 |
ggplot(data = )
aes(x = , y = , color = )
X or Y
Color or Fill
Size
Shape
Others: transparency, animations, faceting
Plots are often referred to by the name of their geometric object(s).
Bar
geom_bar()
Line
geom_line()
Point
geom_point()
?
Path of Hurricane Katrina
Before
scale_x_continuous()
After
scale_x_log10()
Before
scale_size_continuous(breaks = c(25, 75, 125))
After
scale_size_continuous(range = c(0.5, 20), breaks = c(25, 75, 125))
coord_polar()
Facet wrap
facet_wrap(~category)
Facet grid
facet_grid(month~status)
Count
Default theme
fivethirtyeight theme
urbnthemes
Animation
In directory
A
B
Once you understand ggplot2, it is really useful for doing 90% of the results with 10% of the effort
(Jennfer Hill)
A+
B+
A+